package com.nidu.demo.post;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.post.dto.PositionAddCmd;
import com.nidu.demo.post.dto.PositionListQry;
import com.nidu.demo.post.dto.PositionPageQry;
import com.nidu.demo.post.dto.PositionUpdateCmd;
import com.nidu.demo.post.api.SysPositionService;
import com.nidu.demo.post.dto.*;
import com.nidu.demo.post.executor.command.*;
import com.nidu.demo.post.executor.query.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * 职位服务实现类
 *
 * @author auto
 */
@Service
@RequiredArgsConstructor
public class SysPositionServiceImpl implements SysPositionService {

    private final PositionAddCmdExe addCmdExe;
    private final PositionUpdateCmdExe updateCmdExe;
    private final PositionDeleteCmdExe deleteCmdExe;
    private final PositionSingleQryExe singleQryExe;
    private final PositionListQryExe listQryExe;
    private final PositionPageQryExe pageQryExe;

    @Override
    public SingleResponse<PositionCO> add(PositionAddCmd cmd) {
        return addCmdExe.execute(cmd);
    }

    @Override
    public SingleResponse<PositionCO> update(PositionUpdateCmd cmd) {
        return updateCmdExe.execute(cmd);
    }

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public SingleResponse<PositionCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public MultiResponse<PositionCO> list(PositionListQry qry) {
        return listQryExe.execute(qry);
    }

    @Override
    public PageResponse<PositionCO> page(PositionPageQry qry) {
        return pageQryExe.execute(qry);
    }
} 